home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Rescue Raiders.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.0 KB  |  78 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 5
  4. #define theWindowWidth (boundsRect.right-boundsRect.left)
  5. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  6.  
  7. pascal short RescueRaiders(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* One region in 8 parts.  Each part of the region either starts at a corner
  10.    or in the middle of a side and moves progressively clockwise until the
  11.    entire screen is filled. Named after a similar effect in the game Rescue
  12.    Raiders on the Apple ][e (now called Armor Alley™ on the Mac, but it doesn't
  13.    have this effect in it anymore). */
  14.    
  15. pascal short RescueRaiders(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  16. {
  17.     RgnHandle    curregion;
  18.     short            cx,cy,lastx,lasty;
  19.     short            BlockSize, VBlockSize;
  20.     
  21.     cx = theWindowWidth / 2;
  22.     cy = theWindowHeight / 2;
  23.     BlockSize=theWindowWidth/25;
  24.     VBlockSize=theWindowHeight/25;
  25.  
  26.     lasty=lastx=0;
  27.     curregion=NewRgn();
  28.     do
  29.     {
  30.         StartTiming();
  31.  
  32.         SetEmptyRgn(curregion);
  33.         MoveTo(cx,cy);
  34.         OpenRgn();
  35.             LineTo(lastx,0);
  36.             Line(BlockSize,0);
  37.             LineTo(theWindowWidth-lastx-BlockSize,theWindowHeight);
  38.             Line(BlockSize,0);
  39.             LineTo(cx,cy);
  40.             
  41.             LineTo(cx+lastx,0);
  42.             Line(BlockSize,0);
  43.             LineTo(cx-lastx-BlockSize,theWindowHeight);
  44.             Line(BlockSize,0);
  45.             LineTo(cx,cy);
  46.             
  47.             LineTo(theWindowWidth,lasty);
  48.             Line(0,VBlockSize);
  49.             LineTo(0,theWindowHeight-lasty-VBlockSize);
  50.             Line(0,VBlockSize);
  51.             LineTo(cx,cy);
  52.             
  53.             LineTo(theWindowWidth,cy+lasty);
  54.             Line(0,VBlockSize);
  55.             LineTo(0,cy-lasty-VBlockSize);
  56.             Line(0,VBlockSize);
  57.             LineTo(cx,cy);
  58.         CloseRgn(curregion);
  59.         OffsetRgn(curregion, boundsRect.left, boundsRect.top);
  60.         
  61.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  62.             &boundsRect, &boundsRect, 0, curregion);
  63.  
  64.         lastx+=BlockSize;
  65.         lasty+=VBlockSize;
  66.  
  67.         TimeCorrection(CorrectTime);
  68.     }
  69.     while (lastx<cx);
  70.     
  71.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  72.         &boundsRect, &boundsRect, 0, 0L);   /* in case we missed any bits */
  73.     
  74.     DisposeRgn(curregion);
  75.     
  76.     return 0;
  77. }
  78.